import java.util.ArrayList;
import java.util.Date;
/**
 * No copyright.
 * Class to provide collections of events when there are field meets, as they
 * often consist of more than a simple event.
 * @author Quan Nguyen
 * @version 1.02 2008-July-26
 */

public class FieldMeet extends Event implements Comparable<Event>
{

    private String[] fieldMeetLongLabels = {"Academics", "Armed Exhibition", "Armed Regulation", "Color Guard", "PT", "Unarmed Exhibition", "Unarmed Regulation"};
    private String[] fieldMeetEventType = {"ACADEMICS", "DRILL", "DRILL", "DRILL", "PT", "DRILL", "DRILL"};
    private boolean[] performed = {true, true, true, true, true, true, true};
    private String name;
    private Date date;
    private ArrayList<Event> events;
    
    public FieldMeet(String n, Date d)
    {
        super(n,d,"FIELD MEET","Attendance",1);
        events = new ArrayList<Event>();
        for(int i = 0; i < fieldMeetLongLabels.length; i++)
        {
            events.add(new Event(fieldMeetLongLabels[i] + " during " + n, d, fieldMeetEventType[i], "Attendance", 1, this));
        }
    }
    
    public ArrayList<Event> getEvents()
    {
        return events;
    }
    
    public Event getEvent(int idx)
    {
        if(idx >= 0 || idx < events.size())
        {
            return events.get(idx);
        }
        return null;
    }
    
    public void setPerformed(boolean[] arr)
    {
        for(int i = 0; i < performed.length; i++)
        {
            performed[i] = arr[i];
        }
    }
    
    public boolean[] getPerformed()
    {
        return performed;
    }
    
    public int compareTo(FieldMeet that)
    {
        return date.compareTo(that.getDate());
    }
    
    public String performedToString()
    {
        String result = "";
        for(int i = 0; i < performed.length; i++)
        {
            if(performed[i])
                result = result + "1";
            else
                result = result + "0";
        }
        return result;
    }
}
    
    